<script>
	/**
	 * 管理员编辑
	 * @Author Mumu xinglinhe@qq.com
	 * @Date 2022/09/13
	 */
	export default {
		components: {

		},
		props: {

		},
		data() {
			return {
				visible: false,
				data: {},
				loading: false,
				industrycate : {},
				addresscate: {},
			}
		},
		created() {
			this.industrylist();
			this.addresslist();
		},
		methods: {
			async industrylist(){
				let rs	=	await this.muajax.industrycate();
				if(rs.status==200){
					this.industrycate=rs.data;
				}
			},
			async addresslist(){
				let rs	=	await this.muajax.addresscate();
				if(rs.status==200){
					this.addresscate=rs.data;
				}
			},
			send() {
				this.$refs.forms.validate().then(async () => {
					this.loading = true;
					let rs = await this.muajax.MemberSave({
						...this.data,
					});
					this.loading = false;
					if (rs.code == 200) {
						this.$message.success(rs.msg);
						this.visible = false;
						this.$emit("update_list");
					}
				}).catch(err => {
					console.log('验证不通过');
					// this.$errorFocus(err);
				})
			},
			async datainit() {
				let rs = await this.muajax.memberGet({
					id: this.param.id
				});
				if (rs.code == 200) {
					this.data = rs.data;
				}
			}, //初始化本页数据
			show(show, param) {
				this.visible = show;
				if (param) {
					if (show) {
						this.param = param;
						if (!!this.param?.id)
							this.datainit();
					}
				} else {
					this.data = [{}];
				}
			},

		},
		computed: {},
		watch: {},
		filters: {},
	}
</script>
<template>
	<a-modal v-model:visible="visible" destroyOnClose width="960px" title="编辑" :maskClosable="false" @ok="send"
		cancelText="取消" okText="提交" :confirmLoading="loading">
		<a-form ref="forms" :model="data">
			<div>基本信息</div>
			<a-row>
				<a-col :span="8">
					<a-form-item label="姓名" :labelCol="{span: 7}" name="name"
						:rules="[{required:true,message:'请输入姓名'}]">
						<a-input placeholder="请输入" v-model:value="data.name" />
					</a-form-item>
				</a-col>
				<a-col :span="8" :push="1">
					<a-form-item label="性别" name="sex" :rules="[{required:true,message:'请选择性别'}]">
						<a-radio-group v-model:value="data.sex">
							<a-radio value="1">男</a-radio>
							<a-radio value="2">女</a-radio>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="出生年月" :labelCol="{span: 7}" name="birthday"
						:rules="[{required:true,message:'请选择出生年月'}]">
						<a-date-picker v-model:value="data.birthday" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="8">
					<a-form-item label="民族" :labelCol="{span: 7}" name="nation"
						:rules="[{required:true,message:'请输入民族'}]">
						<a-input placeholder="请输入" v-model:value="data.nation" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="籍 贯" :labelCol="{span: 7}" name="nativeplace"
						:rules="[{required:true,message:'请输入籍贯'}]">
						<a-input placeholder="请输入" v-model:value="data.nativeplace" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="从事农业时间" :labelCol="{span: 7}" name="work_time"
						:rules="[{required:true,message:'请选择从事农业时间'}]">
						<a-date-picker v-model:value="data.work_time" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="12" :pull="1">
					<a-form-item label="政治面貌" :labelCol="{span: 7}" name="face"
						:rules="[{required:true,message:'请输入政治面貌'}]">
						<a-input placeholder="请输入" v-model:value="data.face" />
					</a-form-item>
				</a-col>
				<a-col :span="12">
					<a-form-item label="入党时间">
						<a-date-picker v-model:value="data.party_time" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="12" :pull="1">
					<a-form-item label="身份证号码" :labelCol="{span: 7}" name="idcard"
						:rules="[{required:true,message:'请输入身份证号码'}]">
						<a-input placeholder="请输入" v-model:value="data.idcard" />
					</a-form-item>
				</a-col>
				<a-col :span="12">
					<a-form-item label="联系电话" :labelCol="{span: 7}" name="phone"
						:rules="[{required:true,message:'请输入联系电话'}]">
						<a-input placeholder="请输入" v-model:value="data.phone" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="12" :pull="1">
					<a-form-item label="通讯地址" :labelCol="{span: 7}" name="liveaddress"
						:rules="[{required:true,message:'请输入通讯地址'}]">
						<a-input placeholder="请输入" v-model:value="data.liveaddress" />
					</a-form-item>
				</a-col>
				<a-col :span="12">
					<a-form-item label="文化程度" :labelCol="{span: 7}" name="culture"
						:rules="[{required:true,message:'请输入文化程度'}]">
						<a-input placeholder="请输入" v-model:value="data.culture" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="12" :pull="1">
					<a-form-item label="所属地区" :labelCol="{span: 7}" name="address"
						:rules="[{required:true,message:'请选择地区'}]">
						<a-select v-model:value="data.address" placeholder="请选择地区">
							<a-select-option :value="item.id" v-for="(item,index) in addresscate">{{item.name}}</a-select-option>
						</a-select>
					</a-form-item>
				</a-col>
			</a-row>
			<div>企业信息</div>
			<a-row>
				<a-col :span="12" :pull="1">
					<a-form-item label="企业名称" :labelCol="{span: 7}" name="company_name"
						:rules="[{required:true,message:'请输入企业名称'}]">
						<a-input placeholder="请输入" v-model:value="data.company_name" />
					</a-form-item>
				</a-col>
				<a-col :span="12">
					<a-form-item label="组织机构代码" :labelCol="{span: 7}" name="code"
						:rules="[{required:true,message:'请输入组织机构代码'}]">
						<a-input placeholder="请输入" v-model:value="data.code" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="8">
					<a-form-item label="注册时间" :labelCol="{span: 7}" name="register"
						:rules="[{required:true,message:'请输入注册时间'}]">
						<a-date-picker v-model:value="data.register" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="注册资本" :labelCol="{span: 7}" name="capital"
						:rules="[{required:true,message:'请输入注册资本'}]">
						<a-input placeholder="请输入" v-model:value="data.capital" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="法定代表人" :labelCol="{span: 7}" name="legalperson"
						:rules="[{required:true,message:'请输入法定代表人'}]">
						<a-input placeholder="请输入" v-model:value="data.legalperson" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="8">
					<a-form-item label="职工人数" :labelCol="{span: 7}" name="people"
						:rules="[{required:true,message:'请输入职工人数'}]">
						<a-input placeholder="请输入" v-model:value="data.people" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="企业性质" :labelCol="{span: 7}" name="nature"
						:rules="[{required:true,message:'请输入企业性质'}]">
						<a-input placeholder="请输入" v-model:value="data.nature" />
					</a-form-item>
				</a-col>
				<a-col :span="8">
					<a-form-item label="农业分类" :labelCol="{span: 7}" name="classification"
						:rules="[{required:true,message:'请选择农业分类'}]">
						<a-select v-model:value="data.classification" placeholder="请选择农业分类">
							<a-select-option :value="item.id" v-for="(item,index) in industrycate">{{item.name}}</a-select-option>
						</a-select>
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="24" :pull="4">
					<a-form-item label="经营范围" :labelCol="{span: 7}" name="businessscope"
						:rules="[{required:true,message:'请输入经营范围'}]">
						<a-input placeholder="请输入" v-model:value="data.businessscope" />
					</a-form-item>
				</a-col>
			</a-row>
			<a-row>
				<a-col :span="11" style="margin-right:10px;">
					<a-form-item label="2022年收入(万元)" :labelCol="{span: 7}" name="income_one"
						:rules="[{required:true,message:'请输入2022年收入'}]">
						<a-input placeholder="请输入" v-model:value="data.income_one" />
					</a-form-item>
				</a-col>
				<a-col :span="11">
					<a-form-item label="2023年收入(万元)" :labelCol="{span: 7}" name="income_tow"
						:rules="[{required:true,message:'请输入2023年收入'}]">
						<a-input placeholder="请输入" v-model:value="data.income_tow" />
					</a-form-item>
				</a-col>
			</a-row>
		</a-form>
	</a-modal>
</template>
<style lang="less" scoped>

</style>